import { Component, OnInit, ViewChild, TemplateRef, Input, Output, EventEmitter, ChangeDetectionStrategy } from '@angular/core';

@Component({
  selector: 'app-carousel',
  templateUrl: './carousel.component.html',
  styleUrls: ['./carousel.component.less'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class CarouselComponent implements OnInit {
  /** 轮播图下标 */
  @Input()
  activeIndex = 0;

  @Output()
  changeSlide: EventEmitter<string> = new EventEmitter<string>();

  @ViewChild('dot', { static: true })
  dotRef: TemplateRef<any>;

  constructor() { }

  ngOnInit(): void {
  }

  /** 轮播上一页 */
  onChangeSlidePre(): void {
    this.changeSlide.emit('pre');
  }

  /** 轮播下一页 */
  onChangeSlideNext(): void {
    this.changeSlide.emit('next');
  }

}
